import { createStore } from 'vuex'
// 模块导入
import cart from './modules/cart.js'
import user from './modules/user.js'
import category from './modules/category.js'
// 导入vuex持久化插件
import createPersistedstate from 'vuex-persistedstate'

export default createStore({
  modules: {
    cart,
    user,
    category
  },
  // 插件配置
  plugins: [
    createPersistedstate({
      // 本地储存名字
      key: 'erabbit-client-pc-store',
      // 指定需要存储的模块
      paths: ['user', 'cart']
    })
  ]
})
